package workspace;

public class 菲波那切数列 {
    //public class Solution {
        public int Fibonacci(int n) {
            int i = 1;
            int j = 1;
            int sum = 0;
            if(n == 0) {
                return 0;
            }
            if(n == 1 || n == 2 ) {
                return 1;
            }
            for(int k = 3; k <= n;k++) {
                sum = i + j;
                i = j;
                j = sum;
            }
            return sum;
        }
}
